import socket
import requests
def get_host_ip():
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect(('8.8.8.8', 80))
        ip = s.getsockname()[0]
    finally:
        s.close()

    return ip
ipstr=get_host_ip()
url = 'http://getip.zhangsiming.com/ip.php'
#url = 'http://juling.com/ip.php'
d = {'ip':ipstr}
r = requests.post(url, data=d)
print(r)